import geo
import pandas as pd

def direction_bicycling(key,start_address, end_address):
    """    """
    start = geo.geocode(key,start_address)['geocodes'][0]['location']
    end = geo.geocode(key,end_address)['geocodes'][0]['location']
    results = geo.bicycling(key,start, end)
    df = pd.json_normalize(results['data']['paths'][0]['steps'])
    return df

def total_bicycle(df):
    """    """
    distance = df['distance'].to_list()
    sum_num = 0
    for i in distance:
        sum_num += int(i)
    return sum_num

def total_bicycle_time(df):
    """    """
    duration = df['duration'].to_list()
    sum_num = 0
    for i in duration:
        sum_num += int(i)
    return sum_num // 60